import request from "../../../assets/js/request";

/*====================获取字典====================*/

// 发送请求获取后端字典数据
export function dictionaryRequest(tableName, fieldName) {
  return request({
    url: '/api/getDictionaryValue',
    method: 'get',
    params: {
      tableName: tableName,
      fieldName: fieldName
    },
    headers :{
      "Content-Type" : "application/json"
    }
  })
}

/*====================上传图片====================*/
/**
 * 上传图片
 * @param file
 */
// export function uploadFile(formData) {
//   return axios.post(process.env.BASE_API+'/api/uploadFile', formData, {
//     headers: {
//       'Content-Type': 'multipart/form-data',
//       'Authorization': getToken()
//     }
//   })
// }
export function uploadImg(formData) {
  return request({
    url : '/api/uploadImg',
    method : 'post',
    data : formData,
    headers :{
      'Content-Type': 'multipart/form-data'
    }
  })
}

/*====================上传文件====================*/
/**
 * 上传文件
 * @param file
 */
export function uploadFile(formData) {
  return request({
    url : '/api/uploadFile',
    method : 'post',
    data : formData,
    headers :{
      'Content-Type': 'multipart/form-data'
    }
  })
}
